# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.SecurityPolicyUserDefinedField do
  @moduledoc """


  ## Attributes

  *   `base` (*type:* `String.t`, *default:* `nil`) - The base relative to which 'offset' is measured. Possible values are: - IPV4: Points to the beginning of the IPv4 header. - IPV6: Points to the beginning of the IPv6 header. - TCP: Points to the beginning of the TCP header, skipping over any IPv4 options or IPv6 extension headers. Not present for non-first fragments. - UDP: Points to the beginning of the UDP header, skipping over any IPv4 options or IPv6 extension headers. Not present for non-first fragments. required
  *   `mask` (*type:* `String.t`, *default:* `nil`) - If specified, apply this mask (bitwise AND) to the field to ignore bits before matching. Encoded as a hexadecimal number (starting with "0x"). The last byte of the field (in network byte order) corresponds to the least significant byte of the mask.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of this field. Must be unique within the policy.
  *   `offset` (*type:* `integer()`, *default:* `nil`) - Offset of the first byte of the field (in network byte order) relative to 'base'.
  *   `size` (*type:* `integer()`, *default:* `nil`) - Size of the field in bytes. Valid values: 1-4.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :base => String.t() | nil,
          :mask => String.t() | nil,
          :name => String.t() | nil,
          :offset => integer() | nil,
          :size => integer() | nil
        }

  field(:base)
  field(:mask)
  field(:name)
  field(:offset)
  field(:size)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.SecurityPolicyUserDefinedField do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.SecurityPolicyUserDefinedField.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.SecurityPolicyUserDefinedField do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
